package com.ruoyi.yh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yh.mapper.YhArticleInfoMapper;
import com.ruoyi.yh.domain.YhArticleInfo;
import com.ruoyi.yh.service.IYhArticleInfoService;

/**
 * 文章Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-15
 */
@Service
public class YhArticleInfoServiceImpl implements IYhArticleInfoService 
{
    @Autowired
    private YhArticleInfoMapper yhArticleInfoMapper;

    /**
     * 查询文章
     * 
     * @param articleId 文章主键
     * @return 文章
     */
    @Override
    public YhArticleInfo selectYhArticleInfoByArticleId(Long articleId)
    {
        return yhArticleInfoMapper.selectYhArticleInfoByArticleId(articleId);
    }

    /**
     * 查询文章列表
     * 
     * @param yhArticleInfo 文章
     * @return 文章
     */
    @Override
    public List<YhArticleInfo> selectYhArticleInfoList(YhArticleInfo yhArticleInfo)
    {
        return yhArticleInfoMapper.selectYhArticleInfoList(yhArticleInfo);
    }

    /**
     * 新增文章
     * 
     * @param yhArticleInfo 文章
     * @return 结果
     */
    @Override
    public int insertYhArticleInfo(YhArticleInfo yhArticleInfo)
    {
        yhArticleInfo.setCreateTime(DateUtils.getNowDate());
        return yhArticleInfoMapper.insertYhArticleInfo(yhArticleInfo);
    }

    /**
     * 修改文章
     * 
     * @param yhArticleInfo 文章
     * @return 结果
     */
    @Override
    public int updateYhArticleInfo(YhArticleInfo yhArticleInfo)
    {
        yhArticleInfo.setUpdateTime(DateUtils.getNowDate());
        return yhArticleInfoMapper.updateYhArticleInfo(yhArticleInfo);
    }

    /**
     * 批量删除文章
     * 
     * @param articleIds 需要删除的文章主键
     * @return 结果
     */
    @Override
    public int deleteYhArticleInfoByArticleIds(Long[] articleIds)
    {
        return yhArticleInfoMapper.deleteYhArticleInfoByArticleIds(articleIds);
    }

    /**
     * 删除文章信息
     * 
     * @param articleId 文章主键
     * @return 结果
     */
    @Override
    public int deleteYhArticleInfoByArticleId(Long articleId)
    {
        return yhArticleInfoMapper.deleteYhArticleInfoByArticleId(articleId);
    }
}
